<?php

class Users_LoginSuccessView extends SrsUsersBaseView
{
	public function executeHtml(AgaviRequestDataHolder $rd)
	{
		$response = $this->getResponse();

		if ($rd->hasParameter('remember'))
		{
			$response->setCookie('autologon[username]', $rd->getParameter('email'), '+1 week');
			$response->setCookie('autologon[password]', $this->user->getCurrentUser()->getPassword(), '+1 week');
		}

		if ($this->user->hasAttribute('redirect', 'srs.login'))
		{
			$response->setRedirect($this->user->removeAttribute('redirect', 'srs.login'));
		}
		else
		{
			$response->setRedirect($this->genUrl('index'));
		}
  }
}